(function(_window){
	var _editorReg={};
	var _ref=_window.RuleWidgetFactory=function(){};
	_ref.register=function(name,ctor){
		_editorReg[name]=ctor;
	};
	_ref.createWidget=function(type,name,args){
		var ctor=_editorReg[type];
		if(typeof(ctor)!="function"){
			alert("不支持的组件类型："+type);
		}
		var widget=new ctor(name);
		if(typeof(widget.init)=="function"){
			widget.init.apply(widget,args);
		}
		return widget;
	};
})(window);
(function(_window){
	var TextEditor=function(name){
		this.name=name;
	};
	var _proto=TextEditor.prototype;
	_proto.init=function(size,maxLength){
		this.size=size||"10";
		this.maxLength=maxLength||"100";
	};
	_proto.render=function(span){
		var input=document.createElement("input");
		input.type="text";
		input.name=this.name;
		input.maxLength=this.maxLength;
		input.size=this.size;
		$(span).append(input);
		this.input=$(input);
	};
	_proto.setValue=function(value){
		this.input.val(value);
	};
	_window.RuleWidgetFactory.register("Text",TextEditor);
})(window);
